package org.springmole.business.bean;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElements;
import javax.xml.bind.annotation.XmlRootElement;

import org.springmole.business.bean.hibernate.HibernateResultData;
import org.springmole.business.bean.query.QueryResultData;


@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name="Result")
public class Result<T extends ResultData> {
	
	@XmlElement(name="ResultStatus")
	private ResultStatus resultStatus = new ResultStatus();
	
	@XmlElements({
		@XmlElement(name="ResultData", type=DbConnectionResultData.class),
		@XmlElement(name="ResultData", type=SchemaResultData.class),
		@XmlElement(name="ResultData", type=HibernateResultData.class),
		@XmlElement(name="ResultData", type=QueryResultData.class)
	})
	private T resultData = null;

	
	public Result() {
	}
	public Result(Throwable throwable) {
		resultStatus.parseException(throwable);
	}	
	
	public ResultStatus getResultStatus() {
		return resultStatus;
	}
	public void setResultStatus(ResultStatus resultStatus) {
		this.resultStatus = resultStatus;
	}

	
	public T getResultData() {
		return resultData;
	}
	public void setResultData(T resultData) {
		this.resultData = resultData;
	}
	
}
